package treemodel.unit;

import document.Context;
import treemodel.Unit;
import reader.HtmlTag;
import treeview.NodeView;
import treeview.unit.ImageView;

import java.io.File;
import java.util.ArrayList;

/**
 * Created by Pavel Nikolaev
 */
public class ImageUnit extends Unit {
    private File myFileReference = null;

    public ImageUnit(final HtmlTag tag) {
        String path = tag.attributes.get(0).value;
        this.myFileReference = new File(path);
    }

    @Override
    public ArrayList<Unit> breakToWords() {
        ArrayList<Unit> words = new ArrayList<Unit>(1);
        words.add(this);
        return words;
    }

    public NodeView createView(Context context) {
        return new ImageView(context);
    }
}
